<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>6.获取输入的方式</title>
    <!-- 引入Vue -->
    <script type="text/javascript" src="../../js/vue.js"></script>
  </head>
  <body>
    <!-- 准备好一个容器-->
    <div id="demo">
      <h2>学校名称：{{school}}</h2>
      <!-- <input type="text" v-model="str" @keyup.enter="showStr1"> -->
      <!-- <input type="text" @keyup.enter="showStr2"> -->
      <input type="text" v-model="str"> <button @click="showStr3">点我提示用户的输入</button>
    </div>

    <script type="text/javascript">
      new Vue({
        el:'#demo',
        data:{
          school:'尚硅谷',
          str:''
        },
        methods:{
          showStr1(){
            alert(this.str)
          },
          showStr2(event){
            alert(event.target.value)
          },
          showStr3(){
            alert(this.str)
          }
        }
      })
    </script>
  </body>
</html>